package com.kuzan.autocloud.common.model.organization;

import com.kuzan.autocloud.common.model.Base;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * <p>Description: 人员</p>
 *
 * @author kuzank
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name = "sys_organization_person")
public class Person extends Base {

    private String organization;

    private String email;
    private String phone;
    private String wechat;
    private String idcard;
    private String address;
    private String avatar;
    @Column(length = 5)
    private String gender;
    @Column(length = 32)
    private String birthdate;

    // 登陆账号 & 密码
    private String username;
    private String password;

    public static Person of(String title, String id) {
        Person person = new Person();
        person.setId(id);
        person.setTitle(title);
        person.setSort(getSortIncrement());
        return person;
    }

    public static Person of(String title, String id, String organization) {
        Person person = new Person();
        person.setId(id);
        person.setTitle(title);
        person.setOrganization(organization);
        person.setSort(getSortIncrement());
        return person;
    }

}
